package com.migration.model.migration.scripts;

import com.migration.model.migration.AbstractMigrationScript;

/**
 * 风险矩阵-风险等级表(risk_matrix_level)迁移脚本
 */
public class A015_RiskMatrixLevelMigrationScript extends AbstractMigrationScript {

    /**
     * 构造函数，初始化迁移配置
     */
    public A015_RiskMatrixLevelMigrationScript() {
        super(
            "risk_matrix_level",
            "风险矩阵-风险等级数据迁移",
            "ra_risk_grade",
            "risk_matrix_level",
            15
        );
    }

    /**
     * 生成迁移数据的SQL
     *
     * @return 迁移数据的SQL
     */
    @Override
    protected String generateMigrationSql() {
        return "INSERT INTO risk_matrix_level (\n" +
                "    id,\n" +
                "    tenant_id,\n" +
                "    risk_level,\n" +
                "    color,\n" +
                "    ipl,\n" +
                "    score,\n" +
                "    risk_description,\n" +
                "    required_action,\n" +
                "    improvement_suggestion,\n" +
                "    sort_num,\n" +
                "    create_time,\n" +
                "    update_time,\n" +
                "    create_by,\n" +
                "    update_by,\n" +
                "    is_del\n" +
                ")\n" +
                "SELECT\n" +
                "    id,\n" +
                "    1 as tenant_id,\n" +
                "    risk_level,\n" +
                "    level_color,\n" +
                "    CAST(desired_value AS CHAR),\n" +
                "    CAST(score AS CHAR),\n" +
                "    risk_desc,\n" +
                "    required_action,\n" +
                "    improve_advise,\n" +
                "    index_sort,\n" +
                "    DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s'),\n" +
                "    DATE_FORMAT(update_time, '%Y-%m-%d %H:%i:%s'),\n" +
                "    1,\n" +
                "    1,\n" +
                "    is_del\n" +
                "FROM risk_lunnan_test.ra_risk_grade\n" +
                "where tenant_id = 24;";
    }

}
